//
//  CustomThreeImageTableViewCell.m
//  WangI
//
//  Created by dllo on 15/11/25.
//  Copyright © 2015年 WJN. All rights reserved.
//

#import "CustomThreeImageTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation CustomThreeImageTableViewCell

-(void)dealloc {
    [_labelTitle release];
    [_imageV1 release];
    [_imageV2 release];
    [_imageV3 release];
    [super dealloc];
}



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
    
        [self addSubview:self.labelTitle];
        [self addSubview:self.imageV1];
        [self addSubview:self.imageV2];
        [self addSubview:self.imageV3];
        
        [_labelTitle release];
        [_imageV1 release];
        [_imageV2 release];
        [_imageV3 release];
        
    }
    
    return self;
}


#pragma mark -- set

- (void)setHeaderDataSource:(NSArray *)headerDataSource {
    if (_headerDataSource != headerDataSource) {
        [_headerDataSource release];
        [_headerDataSource retain];
    }
    
    _labelTitle.text = headerDataSource[0];
    [_imageV1 sd_setImageWithURL:headerDataSource[1]];
    [_imageV2 sd_setImageWithURL:headerDataSource[2]];
    [_imageV3 sd_setImageWithURL:headerDataSource[3]];
}

- (void)setRecerationDataSource:(NSArray *)recerationDataSource {
    if (_recerationDataSource != recerationDataSource) {
        [_recerationDataSource release];
        [_recerationDataSource retain];
    }
    
    _labelTitle.text = recerationDataSource[0];
    [_imageV1 sd_setImageWithURL:recerationDataSource[1]];
    [_imageV2 sd_setImageWithURL:recerationDataSource[2]];
    [_imageV3 sd_setImageWithURL:recerationDataSource[3]];
}

#pragma mark -- layoutSubviews

-(void)layoutSubviews {
    [super layoutSubviews];
    
    self.labelTitle.frame = CGRectMake(5, 5, self.frame.size.width - 10, 20);
    self.imageV1.frame = CGRectMake(5, 30, (self.frame.size.width - 30) / 3, self.frame.size.height - 30);
    self.imageV2.frame = CGRectMake(_imageV1.frame.size.width + 15, 30, _imageV1.frame.size.width, _imageV1.frame.size.height);
    self.imageV3.frame = CGRectMake(_imageV1.frame.size.width * 2 + 25, 30, _imageV1.frame.size.width, _imageV1.frame.size.height);
}




#pragma mark -- prviate
- (UILabel *)labelTitle {
    if (!_labelTitle) {
        self.labelTitle = [[UILabel alloc] initWithFrame:CGRectZero];
        _labelTitle.font = [UIFont boldSystemFontOfSize:18];
    }
    return _labelTitle;
}

- (UIImageView *)imageV1 {
    if (!_imageV1) {
        self.imageV1 = [[UIImageView alloc] initWithFrame:CGRectZero];
    }
    return _imageV1;
}

- (UIImageView *)imageV3 {
    if (!_imageV3) {
        self.imageV3 = [[UIImageView alloc] initWithFrame:CGRectZero];
    }
    return _imageV3;
}
- (UIImageView *)imageV2 {
    if (!_imageV2) {
        self.imageV2 = [[UIImageView alloc] initWithFrame:CGRectZero];
    }
    return _imageV2;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
